class Solution:
    def numberOfArithmeticSlices(self, A) -> int:
        b = [A[i] - A[i - 1] for i in range(1, len(A))]
        dp = [0] * len(b)
        for i in range(1, len(b)):
            if b[i] == b[i - 1]:
                dp[i] = dp[i - 1] + 1
        return sum(dp)


if __name__ == '__main__':
    so = Solution()
    num = [1, 2, 3, 4]
    r = so.numberOfArithmeticSlices(num)
    print(r)
